<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>可回收管理系统</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>

</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header layui-bg-black">
        <div class="layui-logo">可回收管理系统</div>

        <ul class="layui-nav layui-layout-right" lay-filter="menu1">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    <span id="username"></span>
                </a>
                <dl class="layui-nav-child">
                    <!--           <dd><a href="javascript:;" pageId="userinfo" menuId="userinfo" dataUrl="userinfo.html">基本资料</a></dd> -->
                    <dd><a href="javascript:;" pageId="updateuserpassword" menuId="updateuserpassword" dataUrl="updatepasword.html">修改密码</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="javascript:;" onclick="exit()" >退出系统</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-bg-black"  lay-filter="menu">
                    <li class="layui-nav-item layui-nav-itemed" >
                        <a>权限管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;" pageId="adminlist" id="adminlist1" menuId="datagrid" dataUrl="userlist/adminlist.html">管理员管理</a></dd>
                            <!--             <dd><a href="javascript:;" pageId="rolelist" id="rolelist" menuId="datagrid" dataUrl="torole">角色管理</a></dd> -->
                            <!--             <dd><a href="javascript:;" pageId="menulist" id="menulist" menuId="datagrid" dataUrl="tomenu">菜单管理</a></dd> -->
                        </dl>
                    </li>

                <li class="layui-nav-item layui-nav-itemed" >
                    <a>用户管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" pageId="pay" id="userlist" menuId="datagrid" dataUrl="userlist/userlist.html">用户列表</a></dd>
                        <dd><a href="javascript:;" pageId="pay" id="qyglist" menuId="datagrid" dataUrl="userlist/hsylist.html">回收员列表</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item layui-nav-itemed" >
                    <a>用户端管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" pageId="u_index" id="u_index" menuId="datagrid" dataUrl="u_index/imagelist.html">图片列表</a></dd>
                        <dd><a href="javascript:;" pageId="u_index" id="noticelist" menuId="datagrid" dataUrl="notice/noticelist.html">文案列表</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item layui-nav-itemed" >
                    <a>垃圾管理</a>
                    <dl class="layui-nav-child">

                        <dd><a href="javascript:;" pageId="pay" id="pay1" menuId="datagrid" dataUrl="refuselist/djyy.html">上门预约记录</a></dd>
                        <dd><a href="javascript:;" pageId="pay" id="pay2" menuId="datagrid" dataUrl="refuselist/typelist.html">垃圾类型</a></dd>
                    </dl>
                </li>

            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <div class="layui-tab" lay-allowClose="true" lay-filter="maincontent" >
                <ul class="layui-tab-title">
                </ul>
                <div class="layui-tab-content" style="height: 900px">

                </div>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        可回收管理系统
    </div>
</div>
<script src="layui/layui.js"></script>
<script type="text/javascript" src="js/tool.js"></script>
<script>
    //JavaScript代码区域

    layui.use('element', function(){
        var element = layui.element;
        var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
        //一些事件监听
        element.on('nav(menu)', function(data){
            var title = $(this).html();
            var dataUrl =$(this).attr("dataUrl");
            if(dataUrl!=undefined){
                var pageId = $(this).attr("pageId");

                element.tabDelete('maincontent', pageId);

                element.tabAdd('maincontent', {
                    title: title
                    ,content: "<iframe src="+dataUrl+" frameborder=\"0\" id=\"demoAdmin\" style=\"width: 100%; height: 600px;\"></iframe>\n" //支持传入html
                    ,id: pageId
                });
                //获取hash来切换选项卡，假设当前地址的hash为lay-id对应的值
                element.tabChange('maincontent', pageId);
            }
        });

        //一些事件监听
        element.on('nav(menu1)', function(data){
            console.log(data);

            var title = $(this).html();
            var dataUrl =$(this).attr("dataUrl");
            if(dataUrl!=undefined){
                var pageId = $(this).attr("pageId");

                element.tabDelete('maincontent', pageId);

                element.tabAdd('maincontent', {
                    title: title
                    ,content: "<iframe src="+dataUrl+" frameborder=\"0\" id=\"demoAdmin\" style=\"width: 100%; height: 600px;\"></iframe>\n" //支持传入html
                    ,id: pageId
                });
                //获取hash来切换选项卡，假设当前地址的hash为lay-id对应的值
                element.tabChange('maincontent', pageId);
            }
        });
        $("#index").click();
        //下面获取登陆用户的信息
// 	$.ajax({
// 		type:"post",
// 		dataType:"json",
// 		url:"user/getuserinfo",
// 		async: true,
// 		success: function(data) {
// 			if(data.code==200) {
// 			  //分配权限
// 			  var uid=data.result.uid;
// 			  var level=data.result.level;//0 1 2
//         setStorage("pay_admin_sysleavel",level);
// 			   }
// 		},
// 		error: function(msg) {
// 		}
// 	});
    });

    function exit(){
        //退出
        $.ajax({
            type:"get",
            dataType:"json",
            url:"admin/logOut",
            async: true,
            success: function(data) {
                if(data.code==0) {
                    location.href='login.html'
                } else {
                    alert(data.msg);
                }
            },
            error: function(msg) {
                alert("服务器请求失败！");
            }
        });
    }
</script>
</body>
</html>